home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / edit / ed3.zip / EDDIFFS < prev    next >
Text File  |  1988-02-18  |  3KB  |  121 lines

  1. 9,10d8
  2. <  * 
  3. <  * * * * * * * * * * * *
  4. 11a10,11
  5. >  * * * * * * * * * * * *
  6. >  *
  7. 19c19
  8. <  * 
  9. ---
  10. >  *
  11. 23a24,72
  12. >  *
  13. >  * * * * * * * * * * * *
  14. >  *
  15. >  * Article 2053 of comp.os.minix:
  16. >  * From: dean@ndmath.UUCP (Dean Alvis)
  17. >  * Subject: ed.c tuneup
  18. >  * Keywords: minor adjustments
  19. >  * Message-ID: <930@ndmath.UUCP>
  20. >  * Date: 17 Feb 88 17:22:54 GMT
  21. >  * Organization: Math. Dept., Univ. of Notre Dame
  22. >  *
  23. >  *     I've enjoyed using the recently posted "ed", both on a UNIX
  24. >  * system and at home under CP/M. One minor annoyance is the slowness
  25. >  * of the write command for large (>>1000 lines) files. One solution
  26. >  * is to replace the calls to gettxt() (which in turn call getptr())
  27. >  * in dowrite(). I've lost the original, so can't provide diffs (sorry),
  28. >  * but the idea is to just use a LINE * in the loop in dowrite(), as
  29. >  * follows:
  30. >  *
  31. >  *     LINE *lptr;
  32. >  *     ...
  33. >  *     lptr = getptr(from);
  34. >  *     for(lin=from;lin<=to;lin++) {
  35. >  *         str = lptr->l_buff;
  36. >  *         ++lines;
  37. >  *         bytes += strlen(str)+1;    /* str + '\n' */
  38. >  *         if(fputs(str,fp) == EOF) {
  39. >  *             ...
  40. >  *         }
  41. >  *         fputc('\n',fp);
  42. >  *         lptr = lptr->l_next;
  43. >  *     }
  44. >  *
  45. >  * I've tested this version, and haven't run into trouble yet.
  46. >  * Also, this method avoids the strcpy and strcat to the static buffer
  47. >  * in gettxt(), which seem unnecessary (someone correct me if i'm
  48. >  * missing something here).
  49. >  *
  50. >  *     Another minor annoyance is the state of the current line
  51. >  * number after global commands - my preference is for the last modified
  52. >  * line to be the new current line. Replacing the return(0) by
  53. >  * return(curln) at the end of doglob() will produce this behavior.
  54. >  *
  55. >  *     dean
  56. >  * --
  57. >  * dean@ndmath.UUCP
  58. >  * Dean Alvis, Math. Dept., Univ. of Notre Dame, Notre Dame IN, 46556
  59. >  *
  60. >  *
  61. 67,68c116
  62. < static char    mods[] =    "$TurboC mod: 88/02/13 09:30 RAMontante $";
  63. ---
  64. > static char    mods[] =    "$Mods: 88/02/18 22:00 bobmon $";
  65. 120a169
  66. > #define FATAL    (ERR-1)
  67. 187a237,245
  68. > #ifdef max
  69. > #  undef max
  70. > #  endif
  71. > #ifdef min
  72. > #  undef min
  73. > #  endif
  74. > #ifdef toupper
  75. > #  undef toupper
  76. > #  endif
  77. 193d250
  78. < #define FATAL    (ERR-1)
  79. 335,338c392,393
  80. <                 while(bocl <= lin)
  81. <                 {
  82. <                     if(rval = match(lin, pat, boln))
  83. <                     {
  84. ---
  85. >                 while(bocl <= lin) {
  86. >                     if(rval = match(lin, pat, boln)) {
  87. 1035c1090
  88. <     return(0);
  89. ---
  90. >     return(curln);
  91. 1175a1231
  92. >     LINE    *lptr;
  93. 1178d1233
  94. 1179a1235
  95. 1186,1188c1242,1245
  96. <     for(lin = from; lin <= to; lin++)
  97. <     {
  98. <         str = gettxt(lin);
  99. ---
  100. >     lptr = getptr(from);
  101. >     for(lin = from; lin <= to; lin++) {
  102. >         str = lptr->l_buff;
  103. 1190,1192c1247,1248
  104. <         bytes += strlen(str);
  105. <         if(fputs(str, fp) == EOF)
  106. <         {
  107. ---
  108. >         bytes += strlen(str) + 1;    /* str + '\n' */
  109. >         if(fputs(str, fp) == EOF) {
  110. 1196a1253,1254
  111. >         fputc('\n', fp);
  112. >         lptr = lptr->l_next;
  113. 1363c1421
  114. <         } else 
  115. ---
  116. >         } else
  117.